/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package watcherMode;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author root
 */
public class ConcreteWatched implements Watched{

    private List<Watcher> list = new ArrayList<>();
    
    @Override
    public void addWatcher(Watcher w) {
        list.add(w);
    }

    @Override
    public void removeWatcher(Watcher w) {
        list.remove(w);
    }

    @Override
    public void notifyWatchers(String msg) {
        if(list==null||list.size()<1)
            return;
        for(Watcher w:list){
            w.update(msg);
        }
    }
    
}
